import csv

import cv2

from cjc.tools.img2byte import *

file ='/mnt/d/datasets/face_data/train.csv'
#读取文件并输出结果
a = csv.reader(open(file))

for stu in a:

    byte_data = bytes(stu[0], encoding="utf-8")
    # print(byte_data)
    cvimg = cv2_image_from_byte(byte_data)
    cv2.imshow("",cvimg)
    cv2.waitKey(1000)


# byte_data = b'c3ff641ecfc1'
# hex_data = byte_data.hex()
# print(hex_data)


def img_from_csv(data):
    return bytes(data, encoding="utf-8")




#
# #借助numpy写入数组中
# import numpy as np
# adj = np.loadtxt(open("C:/Users/Deserts/Desktop/adjlist.csv"),delimiter=",",skiprows=0)
#
# #将数组保存为csv文件
# np.savetxt('C:/Users/Deserts/Desktop/adjlist.csv', my_matrix, delimiter = ',')
